package com.kevin.factory;

/**
 * 满减
 *
 * @author kevin
 * @date 2025/8/1
 */
public class CashReturn extends CashSuper {

    private final double moneyFull;

    private final double moneyReturn;

    public CashReturn(double moneyFull, double moneyReturn) {
        this.moneyFull = moneyFull;
        this.moneyReturn = moneyReturn;
    }

    @Override
    public double acceptCash(double money) {
        if (money > moneyFull) {
            return money - Math.floor(money / moneyFull) * moneyReturn;
        }
        return money;
    }
}
